package net.zigin.nhi.could.waste.model;

import java.util.Date;

import lombok.Data;
import net.zigin.commons.util.StringUtil;
import net.zigin.nhi.could.waste.rabbitmq.model.MessageModel;
import net.zigin.nhi.could.waste.aop.LoginAspect;

/*#################################################################*
# 说明:以下代码通过哲勤代码生成工具自动生成    
# 工具:GeneratorCode
# 作者:mgw1986                                                  
# 生成时间:2021-9-23 23:25:01                                               
##################################################################*/

/**
 * WarnBase实体类
 *
 * @author mgw1986
 * @version V1.0
 * @ClassName: WarnBase
 * @date 2021-9-23 23:25:01
 */
@Data
public class WarnBase {
    //预警基础ID--->列名: id
    private String id;
    //医废基础ID--->列名: waste_base_id
    private String wasteBaseId;
    //医废分类ID--->列名: waste_classify_id
    private String wasteClassifyId;
    //医院基础ID--->列名: hospital_base_id
    private String hospitalBaseId;
    //医院科室ID--->列名: hospital_depart_id
    private String hospitalDepartId;
    //预警类型（weight：超重预警，time：超时预警）--->列名: type
    private String type;
    //预警时间--->列名: time
    private Date time;
    //预警状态--->列名: status
    private String status;
    //对象类型（waste：医废，box：集装箱，depart：科室）--->列名: object_type
    private String objectType;
    //对象ID（医废基础ID，集装箱记录ID）--->列名: object_id
    private String objectId;
    //对象编号（医废编号，集装箱编号）--->列名: object_code
    private String objectCode;
    //医废分类名称--->列名: waste_classify_name
    private String wasteClassifyName;
    //医院名称--->列名: hospital_base_name
    private String hospitalBaseName;
    //医院科室名称--->列名: hospital_depart_name
    private String hospitalDepartName;
    //创建人--->列名: create_user
    private String createUser;
    //创建时间--->列名: create_time
    private Date createTime;
    //修改人--->列名: modify_user
    private String modifyUser;
    //修改时间--->列名: modify_time
    private Date modifyTime;
    //处理意见--->列名: remark
    private String remark;

    public WarnBase() {
    }

    public WarnBase(WasteBase wasteBase, String warnType) {
        this.id = StringUtil.get32UUID();
        this.wasteBaseId = wasteBase.getId();
        this.wasteClassifyId = wasteBase.getWasteClassifyCode();
        this.wasteClassifyName = wasteBase.getWasteClassifyName();
        this.hospitalBaseId = wasteBase.getHospitalBaseId();
        this.hospitalBaseName = wasteBase.getHospitalBaseName();
        this.hospitalDepartName = wasteBase.getHospitalDepartName();
        this.hospitalDepartId = wasteBase.getHospitalDepartId();
        this.objectCode = wasteBase.getCode();
        this.objectType = "waste";
        this.objectId = wasteBase.getId();
        this.type = warnType;
        this.status = "wait";
        this.time = new Date();
        this.createTime = new Date();
        this.createUser = LoginAspect.getTokenInfo() == null ? null : LoginAspect.getTokenInfo().getLoginName();
    }

    public WarnBase(WasteBox wasteBox, WasteBoxRecord wasteBoxRecord, String warnType) {
        this.id = StringUtil.get32UUID();
        this.hospitalBaseId = wasteBox.getHospitalBaseId();
        this.hospitalDepartId = wasteBox.getHospitalDepartId();
        this.objectId = wasteBoxRecord.getId();
        this.objectType = "box";
        this.type = warnType;
        this.status = "wait";
        this.time = new Date();
        this.createTime = new Date();
        this.createUser = LoginAspect.getTokenInfo() == null ? null : LoginAspect.getTokenInfo().getLoginName();
    }

    public WarnBase(HospitalDepart hospitalDepart, MessageModel messageModel, Date lastCollectTime) {
        this.id = messageModel.getId();
        this.hospitalDepartId = hospitalDepart.getId();
        this.hospitalBaseId = hospitalDepart.getHospitalBaseId();
        this.hospitalDepartName = hospitalDepart.getName();
        this.objectCode = hospitalDepart.getCode();
        this.objectType = "depart";
        this.objectId = hospitalDepart.getId();
        this.type = messageModel.getTitle();
        this.status = "wait";
        this.time = lastCollectTime;
        this.createTime = new Date();
        this.createUser = LoginAspect.getTokenInfo() == null ? null : LoginAspect.getTokenInfo().getLoginName();
    }
}
